# worm counting helper fuctions
# like, dealing with I/O etc...

##################################################
# does importing modules everywhere use extra memory?
import cv # opencv bindings; installed in package manager
import sys # system specific crap, LIKE sys.argv etc.
import os # system interfaces
import string
import numpy

maxi = lambda a,b: map(max,a,b)
mini = lambda a,b: map(min,a,b)
##################################################

def MkDir(patricia):
  '''a cleaner os.mkdir: makes it if it doesn't exist
  but doesn't make it if it does exist.'''
  print patricia
  if not(os.path.exists(patricia)): os.mkdir(patricia)
##################################################

#def BoundedRect(center=[0,0],rect=[1,1],bound=[1,1]):
  ## returns a rectangle around center
  ##fuck it, i don't wanna think about elegance
  ## rect should be even, otherwise rounding
  #rhett = [0,0,0,0] # x,y,dx,dy
  ##really, minumum and maximum corners...
  #[center[0]

#def Rect2Points(rect):
  ## (x,y,dx,dy) to [[x1,y1]...[x4,y4]]

#def Point2Rect(points):
  ## see inverse case

###################################################
## NEED:
## - keystroke to number
#parsival = lambda key: key - 48 # in the future, more
## the maximum element of 2 arrays, maybe overkill putting in a module!

